<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/commons/pages/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${naviString}</title>
<link href="${ctx}/commons/styles/themes/blue/styles/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/commons/scripts/jquery-ui/themes/redmond/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
  <div align="center" style="width: 99%">
    <div align="left" class="nav">${naviString}</div>
    <fieldset>
    <legend>快速搜索</legend>
    <html-el:form action="/manager/OnlineOrder.do">
      <html-el:hidden property="method" value="list" />
      <html-el:hidden property="mod_id" />
      客户姓名：
      <html-el:text property="name_like" />  
     订单时间：
      <fmt:formatDate value="${hf.map._create_time}" pattern="yyyy-MM-dd" var="create_time" />
      <html-el:text property="create_time" styleId="create_time" value="${create_time}" size="10" readonly="true" style="cursor:pointer" />
      &nbsp;
      订单状态:
      <html-el:select property="state">
        <html-el:option value="">请选择...</html-el:option>
        <c:forEach var="d_cur" items="${dealmodeList}">
           <html-el:option value="${d_cur.dictionary_value}">${d_cur.dictionary_desc_cn}</html-el:option>
        </c:forEach>
      </html-el:select>
      &nbsp;
      <html-el:submit value="快速搜索" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
    </html-el:form>
    </fieldset>
    <%@ include file="/commons/pages/messages.jsp" %>
    <br/>
    <form id="listForm" name="listForm" method="post" action="OnlineOrder.do">
      <table width="100%" border="0" cellpadding="0" cellspacing="1" class="datagrid">
        <tr>
          <th nowrap="nowrap">促销活动</th>
          <th width="8%" nowrap="nowrap">客户姓名</th>
          <th width="8%" nowrap="nowrap">客户性别</th>
          <th width="15%" nowrap="nowrap">订单时间</th>
          <th width="8%" nowrap="nowrap">总金额</th>
          <th width="8%" nowrap="nowrap">订单状态</th>
          <th width="12%" nowrap="nowrap">操作</th>
        </tr>
        <c:forEach var="cur" items="${entityList}" varStatus="vs">
          <tr>
            <td align="left"><a href="OnlineOrder.do?method=view&mod_id=${hf.map.mod_id}&id=${cur.id}">${cur.title}</a></td>
            <td align="center" nowrap="nowrap">${cur.name}</td>
            <td align="center" nowrap="nowrap"><c:if test="${cur.sex eq 0}">先生</c:if><c:if test="${cur.sex eq 1}">女士</c:if></td>
            <td align="center" nowrap="nowrap"><fmt:formatDate value="${cur.create_time}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
            <td align="center" nowrap="nowrap">${cur.total_price}<c:if test="${not empty cur.total_price}">元</c:if></td>
            <td align="center" nowrap="nowrap"><c:if test="${cur.state eq 0}">未处理</c:if><c:if test="${cur.state eq 1}">已付订金</c:if>
              <c:if test="${cur.state eq 2}">已付全款</c:if><c:if test="${cur.state eq 3}">取消订单</c:if>
              <c:if test="${cur.state eq 9}">其他</c:if><c:if test="${cur.state eq 99}">已归档</c:if></td>
            <td align="center" nowrap="nowrap"><c:if test="${cur.state ne 99}"><html-el:button property="deal" value="处理订单" onclick="confirmUpdate(null, 'OnlineOrder.do', 'id=${cur.id}&' + $('#bottomPageForm').serialize())" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
              &nbsp;&nbsp;<html-el:button property="archive" value="归档订单" onclick="archive_order('${cur.id}')" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" /></c:if>
              <c:if test="${cur.state eq 99}"><html-el:button property="deal" value="处理订单" disabled="true" styleClass="ui-state-default ui-corner-all" />
              &nbsp;&nbsp;<html-el:button property="archive" value="归档订单" disabled="true" styleClass="ui-state-default ui-corner-all" /></c:if>
            </td>
          </tr>
        </c:forEach>
      </table>
    </form>
    <form id="bottomPageForm" name="bottomPageForm" method="post" action="OnlineOrder.do">
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="40" align="center"><script type="text/javascript" src="${ctx}/commons/scripts/pager.js">;</script>
            <script type="text/javascript">
            var pager = new Pager(document.bottomPageForm, ${hf.map.pager.recordCount}, ${hf.map.pager.pageSize}, ${hf.map.pager.currentPage});
            pager.addHiddenInputs("method", "list");
            pager.addHiddenInputs("mod_id", "${hf.map.mod_id}");
            pager.addHiddenInputs("name_like", "${fn:escapeXml(hf.map.name_like)}");
            pager.addHiddenInputs("create_time", "${create_time}");
            pager.addHiddenInputs("news_id", "${hf.map.news_id}");
            pager.addHiddenInputs("state", "${hf.map.state}");
            document.write(pager.toString());
            </script>
          </td>
        </tr>
      </table>
    </form>
  </div>
</div>
<script type="text/javascript" src="${ctx}/commons/scripts/jquery.js"></script>
<script type="text/javascript" src="${ctx}/commons/scripts/jquery-ui/ui/minified/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="${ctx}/commons/scripts/rowEffect.js"></script>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
	$("input[type='submit'],input[type='button']").css("border", "1px solid");

	$("#create_time").datepicker();
});

function archive_order(id){
	if(confirm("归档后订单将无法再处理，确认归档？")){
		location.href = "OnlineOrder.do?method=archive&mod_id=${hf.map.mod_id}&id=" + id + "&" + $('#bottomPageForm').serialize();
	}
}
//]]></script>
</body>
</html>
